package com.framework.model.system;

import com.framework.common.annotation.QueryParam;
import com.framework.common.model.validation.ValidationGroup;
import com.framework.common.util.match.MatchConstantUtil;
import com.framework.common.util.other.NumeralUtil;
import com.framework.model.base.BaseModel;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author 龘鵺
 * @version 1.0
 * @className com.framework.model.system
 * @description 系统后台黑名单IP实体类
 * @datetime 2019-01-09 11:11:11
 */
public class SystemBackstageBlackListIp extends BaseModel implements Serializable {
    private static final long serialVersionUID = -1L;
    /**
     * 启用状态=1启用,2禁用 ENABLE_STATUS
     */
    @NotNull(message = "请选择启用状态", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @Min(value = NumeralUtil.POSITIVE_ONE, message = "错误选择", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @Max(value = NumeralUtil.POSITIVE_TWO, message = "错误选择", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @QueryParam(name = "enableStatus", code = "p.ENABLE_STATUS")
    private Integer enableStatus;
    /**
     * IP IP
     */
    @NotBlank(message = "请输入IP地址", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @Pattern(regexp = MatchConstantUtil.REGEX_IP, message = "请输入正确IP地址", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @QueryParam(code = "p.IP")
    private String ip;
    /**
     * 描述 DESCRIPTION
     */
//    @NotBlank(message = "请输入描述", groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @Size(message = "描述最多1000个字符", max = NumeralUtil.POSITIVE_ONE_THOUSAND, groups = {ValidationGroup.formEdit.class, ValidationGroup.formAdd.class})
    @QueryParam(code = "p.DESCRIPTION")
    private String description;

    public Integer getEnableStatus() {
        return enableStatus;
    }

    public void setEnableStatus(Integer enableStatus) {
        this.enableStatus = enableStatus;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip == null ? null : ip.trim();
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }
}